home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / comp / whilestm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  1.2 KB  |  52 lines

  1. /*
  2.                             W H I L E S T A . C
  3. */
  4.  
  5. #include "iccomp.h"
  6.  
  7. ESTRUC_ *while_stmnt(e, s)
  8.     ESTRUC_
  9.         *e,
  10.         *s;
  11. {
  12.     register unsigned
  13.         len,
  14.         *list;
  15.  
  16.     nestlevel--;                            /* reduce nesting level */
  17.     break_ok--;                             /* reduce break ok */
  18.  
  19.     etob(e);                                /* make links for E */
  20.  
  21.     if (test_type(e, e_const))              /* constant: never xeq */
  22.     {
  23.         if (e->evalue)
  24.             e->evalue = 0;                  /* no value = no code for catcode */
  25.                                             /* MAYBE CODELEN = 0 ?? */
  26.         else
  27.         {
  28.             clearbin(e, s);
  29.             return (e);
  30.         }
  31.     }
  32.  
  33.     patchup_true(e, 1);                     /* patch to EOC */
  34.  
  35.     list = e->falselist;
  36.     len  = e->falselen;
  37.  
  38.     e->falselen = 0;                        /* no more false links avail. */
  39.  
  40.     catcode(e, s);                          /* append s to e */
  41.  
  42.     gencode(e, op_jmp, j_falselist);        /* jmp to begin of code */
  43.  
  44.     patchup_false(e, 0);                    /* patch to BOC */
  45.  
  46.     e->falselist = list;
  47.     e->falselen = len;
  48.  
  49.     patchup_true(e, 1);                    /* patchup break targets to EOC */
  50.  
  51.     return (e);
  52. }